<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-alert lvType="info" *ngIf="realTimeStatus">
    <span [innerHTML]="numTip"></span>
</lv-alert>
<div class="aui-operation">
    <lv-group lvGutter="8px">
        <lv-pro-button-group [config]="optsConfig" [bindData]="selectionData" [maxDisplayItems]="3">
        </lv-pro-button-group>
    </lv-group>
    <lv-group>
        <lv-group lvGutter="8px">
            <lv-search [lvFocus]="true" [(ngModel)]="name" (lvSearch)="search()"
                lvPlaceHolder="{{'common_search_type_label'|i18n:['']}}">
            </lv-search>
            <button class="aui-button-icon" lv-button lvSize="auto" (click)="dataTable?.fetchData()">
                <i lv-icon="lv-icon-refresh" [lvColorState]="true"></i>
            </button>
        </lv-group>
    </lv-group>
</div>

<ng-container *ngIf="realTimeStatus">
    <div class="list-container" id="honey-pot-anti">
        <lv-pro-table #dataTable [config]="tableConfig" [data]="tableData"></lv-pro-table>
    </div>
</ng-container>
<ng-container *ngIf="!realTimeStatus">
    <div class="no-data">
        <lv-empty [lvDescription]="emptyTpl"></lv-empty>
    </div>
</ng-container>

<ng-template #emptyTpl>
    <span [innerHTML]="noDataTip"></span>
</ng-template>



<ng-template #statusTpl let-item>
    <span *ngIf="!item.status">
        <i lv-icon="aui-icon-loading" class="lv-m-rotate"></i>
    </span>
    <span *ngIf="item.status">
        <aui-status [value]="item.status" type="fileHoneypotStatus"></aui-status>
    </span>
</ng-template>

<ng-template #periodTpl let-item>
    <ng-container *ngIf="item.status === dataMap.fileHoneypotStatus.enable.value; else elseTemplate">
        <span lv-overflow *ngIf="item.period !== '--'">
            {{'common_every_label' | i18n}}{{item.period}}{{'common_day_label'|i18n}}
        </span>
        <span *ngIf="item.period === '--'">
            {{'explore_honeypot_not_update_label' | i18n}}
        </span>
    </ng-container>
    <ng-template #elseTemplate>
        --
    </ng-template>
</ng-template>